package com.example.designpattenexample.memento.example;

public class Document {

    private String content;

    private String otherContent;


    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getOtherContent() {
        return otherContent;
    }

    public void setOtherContent(String otherContent) {
        this.otherContent = otherContent;
    }

    public Backup backup(){
        System.out.println("保存备份");
        return new Backup(content);
    }

    public void resume(Backup backup){
        this.setContent(backup.getContent());
    }

    @Override
    public String toString() {
        return "Document{" +
                "content='" + content + '\'' +
                ", otherContent='" + otherContent + '\'' +
                '}';
    }
}
